import threading


class singleton:
    instance = None
    lock = threading.RLock()

    def __inint__(self,name):
        self.name = name
    

    def __new__(cls,*args,**kwargs):
        if cls.instance:
            return cls.instance
        

        with cls.lock:
            if cls.instance:
                return cls.instance
            cls.instance = object.__new__(cls)
            return cls.instance


def task():
    obj = singleton("blwang")
    print(obj)



for _ in range(10):
    t = threading.Thread(target=task)
    t.start()

    

